﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gedea.Model.Entities;
using Gedea.Core.Repositories;

namespace Gedea.Service.Services
{
    public class CustomerService
    {
        //TODO imitar a areaService
        public void Add(Customer customer)
        {
            customer.UserId = Credentials.currentUser.UserId;
            new CustomerRepository().Add(customer);
        }

        public List<Customer> List()
        {
            return new CustomerRepository().List(Credentials.currentUser);
        }

        public Customer Get(int id)
        {
            return new CustomerRepository().Get(id);
        }

        public List<Customer> ListBy(Model.DBObjects.Customers field, string q)
        {
            return new CustomerRepository().ListBy(field, q);
        }
        public void Update(Customer cust)
        {
            cust.UserId = Credentials.currentUser.UserId;
            new CustomerRepository().Update(cust);
        }
    }
}
